package com.anjubao.parking.municipal.payment.constant;

import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author zhuchunfeng
 * @date 2019/4/26 15:12
 */
public enum TradeTypeEnum {
    JSAPI("JSAPI", "JSAPI支付"),
    NATIVE("NATIVE", "NATIVE支付"),
    APP("APP", "APP支付"),
    MWEB("MWEB", "H5支付");

    @JsonValue
    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    TradeTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private String code;

    private String desc;

    public static Boolean exist(String code) {
        if (code == null) {
            return false;
        }
        for (TradeTypeEnum e : TradeTypeEnum.values()) {
            if (e.getCode() .equals(code)) {
                return true;
            }
        }
        return false;
    }
}
